package cn.edu.nju.software.cdiy.algorithm.performance;

import cn.edu.nju.software.cdiy.bean.SoundCard;
import cn.edu.nju.software.cdiy.util.Constant;

public class SoundCardEvaluator implements Evaluator<SoundCard>{

	@Override
	public double getPerformance(SoundCard t) {
		double score = 0;
		
		//声道
		int soundChannel = t.getSoundChannel().getKey();
		double soundChannelScore = getSoundChannelBase(soundChannel)*Constant.SC_STD_SOUNDCHANNEL;
		
		
		//采样位数
		int sampleSize = t.getSampleSize().getKey();
		double sampleSizeScore = getSampleSizeBase(sampleSize)*Constant.SC_STD_SAMPLESIZE;
		
		
		
		score = soundChannelScore+sampleSizeScore;
		return score;
	}

	private double getSampleSizeBase(int sampleSize) {
		/*
		 * 采样位数基础分
		 * 611			90
		 * 612			80
		 * 613			70
		 * 614			90
		 * 615			75
		 * */
		switch(sampleSize){
		case 611:
			return 90;
		case 612:
			return 80;
		case 613:
			return 70;
		case 614:
			return 90;
		case 615:
			return 75;
		default:
			return 80;
		
		
		}
	}

	private double getSoundChannelBase(int soundChannel) {
		/*
		 * 声道基础分
		 * 601		60
		 * 602		70
		 * 603		80
		 * 604		90
		 * */
		switch(soundChannel){
		case 601:
			return 60;
		case 602:
			return 70;
		case 603:
			return 80;
		case 604:
			return 90;
		default:
			return 90;
		}
	}

}
